
package com.jf.cloud.api.product.feign;

import com.jf.cloud.common.feign.FeignInsideAuthConfig;
import com.jf.cloud.common.product.vo.CategoryVO;
import com.jf.cloud.common.response.ServerResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author zz
 * @date 2020/12/23
 */
@FeignClient(value = "jfcloud-product",contextId = "category")
public interface CategoryFeignClient {

    /**
     * 根据上级id，获取子分类id列表
     * @param categoryId
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/category/listCategoryId")
    ServerResponseEntity<List<Long>> listCategoryId(@RequestParam("categoryId") Long categoryId);

    /**
     * 根据分类id，获取分类及分类国际化信息
     * @param categoryId
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/category/getByCategoryId")
    ServerResponseEntity<CategoryVO>  getByCategoryId(@RequestParam("categoryId") Long categoryId);

    /**
     * 根据分类id获取一级分类/二级分类/三级分类
     * @param categoryId
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/category/getCategoryAllById")
    ServerResponseEntity<String> getCategoryAllById(@RequestParam("categoryId") Long categoryId);

    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/category/getByCategoryIds")
    ServerResponseEntity<List<CategoryVO>>  getByCategoryIds(@RequestBody Set<Long> categoryIds);

    /**
     * 查询所有一级分类
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/category/listPrimaryCategoryId")
    ServerResponseEntity<List<Map<String,Object>>> listPrimaryCategoryId();

    /**
     * 根据一级分类查询下所有商家ID
     * @param cateId
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/category/listByPrimaryCategoryId")
    ServerResponseEntity<List<Long>> listByPrimaryCategoryId(@RequestParam("cateId") Long cateId);
}
